import { IPSControlHandlerAction } from '../ipscontrol-handler-action';
import { IPSAjaxControlHandler } from './ipsajax-control-handler';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAjaxControlHandlerImpl extends PSModelObjectImpl implements IPSAjaxControlHandler {
  get cacheScope(): 0 | 1 | 2 | 3 | 4 {
    return this.M.cacheScope != null ? this.M.cacheScope : 0;
  }

  get cacheTimeout(): number {
    return this.M.cacheTimeout != null ? this.M.cacheTimeout : -1;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get handlerObj(): string {
    return this.M.handlerObj;
  }

  get handlerTag(): string {
    return this.M.handlerTag;
  }

  get handlerTag2(): string {
    return this.M.handlerTag2;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pshandleractions: IPSControlHandlerAction[] | null = null;

  getPSHandlerActions(): IPSControlHandlerAction[] | null {
    if (this.pshandleractions == null) {
      this.pshandleractions = this.fillChildListModel(this.M.getPSHandlerActions, 'control.IPSControlHandlerAction') as IPSControlHandlerAction[];
    }
    return this.pshandleractions;
  }

  get psHandlerActions(): IPSControlHandlerAction[] | null {
    return this.getPSHandlerActions();
  }

  findPSControlHandlerAction(objKey: any): IPSControlHandlerAction | null {
    return this.getPSModel5('control.IPSControlHandlerAction', this.getPSHandlerActions(), objKey) as IPSControlHandlerAction;
  }

  get uniStateField(): string {
    return this.M.uniStateField;
  }

  get uniStateKeyValue(): string {
    return this.M.uniStateKeyValue;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableCache(): boolean {
    return this.M.enableCache != null ? this.M.enableCache : false;
  }

  get enableDEFieldPrivilege(): boolean {
    return this.M.enableDEFieldPrivilege;
  }

  get cls(): string {
    return 'PSAjaxControlHandlerImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSControlHandler' || cls == 'control.ajax.IPSAjaxControlHandler' || cls == 'control.ajax.IPSAjaxHandler') return true;
    return super.instanceof(cls);
  }
}
